<?
/**
 * Debug function
 * Prints unformatted vars string
 */
function d(){
    foreach(func_get_args() as $arg){
        print "<pre style='overflow: auto; z-index: 1001 !important; text-align: left !important; background: #000 !important; color: #0a0 !important; padding: 1ex !important; margin: 1ex !important; border: 1px solid #900 !important'>";
        print_r($arg);
        print "</pre>";
    }
}

function vd(){
    foreach(func_get_args() as $arg){
        var_dump($arg);
    }
}

/**
 * Trantsating string in current language
 * @param string $str input string
 * @param array $replacers array whithin replases parameters
 * @return string output strung
 */
function t($str, $replacers = array()){
    if(isset($GLOBALS['MESS'][$str]))
        $str = $GLOBALS['MESS'][$str];
    if(!empty($replacers)){
        foreach($replacers as $pattern => $replace){
            $str = str_replace($pattern, t($replace), $str);
        }
    }
    return $str;
}

function IncludeClass($name, $dir = "/"){
    $exists = false;    
    if(file_exists("$dir/$name.class.php")){
        require_once "$dir/$name.class.php";
    }
    return $exists;
}